<template>
  <h3>rest接收参数</h3>
  id:{{ $route.params.id }}<br/>
  userName:{{ $route.params.userName }}<br/>
  password:{{ $route.params.password }}<br/>

  <h3>获取props中的数据</h3>
  id:{{id}}<br/>
  userName:{{userName}}<br/>
  password:{{password}}<br/>

  <h3>获取data中的数据</h3>
  did:{{did}}<br/>
  duserName:{{duserName}}<br/>
  dpassword:{{dpassword}}<br/>

</template>

<script>
export default {
  name: "user",
  props:['id','userName','password'],
  data(){
    return{
      did:0,
      duserName:'',
      dpassword:''
    }
  },
  created() { //created在vue组件创建之后
    this.did = this.id  //props中的数据可以通过this直接访问 也可以在页面中直接访问
    this.duserName = this.userName
    this.dpassword = this.password
  }
}
</script>

<style scoped>

</style>